#ifndef RCONSTDIFINITION_H
#define RCONSTDIFINITION_H
#include <QFont>
#include <QtEndian>

const QString KI18NFilePath("/opt/ereader/qml/i18n/");

const QString KI18NFilePrefix("ereader_");

const QString KI18NFileSuffix(".qm");

const QString KI18NLangCN("zh");

const QString KI18nLangEN("en");

const QString KCObjectId("_ROWID_");

const QString KJoin(" JOIN ");

const QString KLeft(" LEFT ");

const QString KLeftJoin(KLeft + KJoin);

const QString KUnion(" UNION ");

const QString KOpAdd(" + ");

const QString KOpEqual(" = ");

const QString KOpMinus(" - ");

const QString KOpMod(" % ");

const QString KOpLess(" < ");

const QString KOpLessEqual(" <= ");

const QString KOpMore(" > ");

const QString KOpMoreEqual(" >= ");

const QString KOpNotEqual( " <> ");

const QString KOpMultiply(" * ");

const QString KOpDivide(" / ");

const QString KOn(" ON ");

const QString KAnd(" AND ");

const QString KOr(" OR ");

const QString KIn(" IN ");

const QString KNot(" NOT ");

const QString KMinus(" MINUS ");

const QString KIntersect(" INTERSECT ");

const QString KEqual(" = ");

const QString KDistinct(" DISTINCT ");

const QString KWhere(" WHERE ");

const QString KSelect("SELECT ");

const QString KUpdate("UPDATE ");

const QString KDelete("DELETE FROM ");

const QString KSet(" SET ");

const QString KInsert("INSERT INTO ");

const QString KValues(" VALUES ");

const QString KCreateTable("CREATE TABLE ");

const QString KTypeInt(" INTEGER ");

const QString KTypeBool(" BOOL ");

const QString KTypeStr(" TEXT ");

const QString KTypeFloat(" FLOAT ");

const QString KTypeDouble(" DOUBLE ");

const QString KNotNull(" NOT NULL ");

const QString KPrimaryKey(" PRIMARY KEY ");

const QString KAutoIncrement(" AUTOINCREMENT ");

const QString KAll(" * ");

const QString KFrom(" FROM ");

const QString KCountAll(" COUNT(*) ");

const QString KCount(" COUNT");

const QString KSum(" SUM");

const QString KOrderBy(" ORDER BY ");

const QString KGroupBy(" GROUP BY ");

const QString KHaving(" HAVING ");

const QString KDesc(" DESC ");

const QString KAsc(" ASC ");

const QString KSelectAllFrom(KSelect + KAll + KFrom);

const QString KDot(".");

const QString KAs(" AS ");

const QString KComma(",");

const QString KNullString("");

const QString KNull("NULL");

const QString KDbNullString("''");

const QString KPathSeparator("/");

const QString KPathSeparatorWin("\\");

const QString KDriveSymbol(":");

const QString KUnderLine("_");

const QString KSingleQuotes("'");

const QString KSpace(" ");

const QString KTableChar("\t");

const QString KNewLine("\n");

const QString KDatabaseType("QSQLITE");

const QString KUmdFileSuffix("umd");
const QString KTxtFileSuffix("txt");
const QString KUncompressedFileSuffix("utxt");

const uchar KNewLineCodeDefault = 0x0A;
const quint16 KNewLineCodeUtf16Le = qToLittleEndian<quint16>(0x0A);
const quint16 KNewLineCodeUtf16Be = qToBigEndian<quint16>(0x0A);
const quint32 KNewLineCodeUtf32Le = qToLittleEndian<quint32>(0x0A);
const quint32 KNewLineCodeUtf32Be = qToBigEndian<quint32>(0x0A);
const quint16 KNewLineCodeUmdLe = qToLittleEndian<quint16>(0x2029);


//#define MEM_DB
#ifdef MEM_DB
const QString KDatabaseName(":memory:");
#else
const QString KDatabaseName("eReader.db");
#endif
const QString KTableId("_ROWID_");
const int KInvalidId = -1;
//Let's assume one line's length is no more than 2000
const qint64 KLineMaxLength = 2000;

/**
 * File table definition
 */
const QString KTableFile("file");
const QString KFileId(KTableId);
const QString KFileName("name");
const QString KFileLineCount("line_count");
const QString KFileLastModifyTime("last_modify");
const QString KFileLastReadTime("last_read_time");
const QString KFileLastReadLine("last_read_line");
const QString KFileLastReadCharIndex("last_read_char_index");
const QString KFileCodec("codec");

//Bookmark definition
const QString KTableBookmark("bookmark");
const QString KBookmarkId(KTableId);
const QString KBookmarkFileId("file_id");
const QString KBookmarkNote("note");
const QString KBookmarkLine("line");
const QString KBookmarkCharIndex("char_index");
const QString KBookmarkAddTime("add_time");

///////////////////////////Codecs////////////////////////////////

//const char* KTranslationContextCodec = "TranCtxCodec";
const QString KCodecNotAvailable("Not Avaliable");
const QString KCodecAuto("Auto");
const QString KCodecSystem("System");

//Unicode
const QString KLanRegionUnicode = QString::fromUtf8("Unicode");
const QString KCodecUTF8("UTF-8");
const QString KCodecUTF16LE("UTF-16LE");
const QString KCodecUTF16BE("UTF-16BE");
const QString KCodecUTF32LE("UTF-32LE");
const QString KCodecUTF32BE("UTF-32BE");
const QString KLanRegionUnicodeDefaultCodec = KCodecUTF8;

//Arabic
const QString KLanRegionArabic = QString::fromUtf8("Арабська");
const QString KCodecISO_8859_6("ISO-8859-6");
const QString KCodecWindows1256("windows-1256");
const QString KCodecWindows1257("windows-1257");
const QString KLanRegionArabicDefaultCodec = KCodecISO_8859_6;

//Baltic
const QString KLanRegionBaltic = QString::fromUtf8("Baltic");
const QString KCodecISO_8859_4("ISO-8859-4");
const QString KCodecISO_8859_13("ISO-8859-13");
const QString KLanRegionBalticDefaultCodec = KCodecISO_8859_4;


//Celtic
const QString KLanRegionCeltic = QString::fromUtf8("Celtic");
const QString KCodecISO_8859_14("ISO-8859-14");
const QString KLanRegionCelticDefaultCodec = KCodecISO_8859_14;

//Cyrillic
const QString KLanRegionCyrillic = QString::fromUtf8("русский/Український");
const QString KCodecISO_8859_5("ISO-8859-5");
const QString KCodecKOI8_U("KOI8-U");
const QString KCodecKOI8_R("KOI8-R");
const QString KCodecWindows1251("windows-1251");
const QString KLanRegionCyrillicDefaultCodec = KCodecKOI8_U;

//Central European
const QString KLanRegionCentralEuro = QString::fromUtf8("Central European");
const QString KCodecWindows1250("windows-1250");
const QString KLanRegionCentralEuroDefaultCodec = KCodecWindows1250;

//Simple Chinese
const QString KLanRegionChinaMainLand = QString::fromUtf8("中国大陆");
const QString KCodecGB2312("GB2312");
const QString KCodecGB18030("GB18030");
const QString KCodecGBK("GBK");
const QString KLanRegionChinaMainLandDefaultCodec = KCodecGB18030;

//Traditional Chinese
//Taiwan
const QString KLanRegionChinaTaiwan = QString::fromUtf8("中國台灣");
const QString KCodecBig5("Big5");
const QString KLanRegionChinaTaiwanDefaultCodec = KCodecBig5;

//Hong Kong
const QString KLanRegionChinaHongKong = QString::fromUtf8("中國香港");
const QString KCodecBig5_HKSCS("Big5-HKSCS");
const QString KLanRegionChinaHongKongDefaultCodec = KCodecBig5_HKSCS;

//Eastern European
const QString KLanRegionEasternEuro = QString::fromUtf8("Eastern European");
const QString KCodecISO_8859_2("ISO-8859-2");
const QString KLanRegionEasternEuroDefaultCodec = KCodecISO_8859_2;

//Greek
const QString KLanRegionGreek = QString::fromUtf8("ελληνικά");
const QString KCodecISO_8859_7("ISO-8859-7");
const QString KCodecWindows1253("windows-1253");
const QString KLanRegionGreekDefaultCodec = KCodecISO_8859_7;

//Hebrew
const QString KLanRegionHebrew = QString::fromUtf8("עברית");
const QString KCodecISO_8859_8("ISO-8859-8");
const QString KCodecWindows1255("windows-1255");
const QString KLanRegionHebrewDefaultCodec = KCodecISO_8859_8;

//Japanese
const QString KLanRegionJapanese = QString::fromUtf8("日本語");
const QString KCodecShift_JIS("Shift_JIS");
const QString KCodecEUC_JP("EUC-JP");
const QString KCodecISO_2022_JP("ISO-2022-JP");
const QString KLanRegionJapanesDefaultCodec = KCodecShift_JIS;

//Korean
const QString KLanRegionKorean = QString::fromUtf8("한국의");
const QString KCodecEUC_KR("EUC-KR");
const QString KCodecISO_2022_KR("ISO-2022-KR");
const QString KCodecWindows949("windows-949");
const QString KLanRegionKoreanDefaultCodec = KCodecEUC_KR;

//Thai
const QString KLanRegionThai = QString::fromUtf8("ไทย");
const QString KCodecTIS_620("TIS-620");
const QString KLanRegionThaiDefaultCodec = KCodecTIS_620;

//Turkish
const QString KLanRegionTurkish = QString::fromUtf8("Türk");
const QString KCodecISO_8859_3("ISO-8859-3");
const QString KCodecISO_8859_9("ISO-8859-9");
const QString KCodecWindows1254("windows-1254");
const QString KLanRegionTurkishDefaultCodec = KCodecISO_8859_3;

//Western European
const QString KLanRegionWesternEuro = QString::fromUtf8("Western European");
const QString KCodecISO_8859_1("ISO-8859-1");
const QString KCodecISO_8859_15("ISO-8859-15");
const QString KCodecWindows1252("windows-1252");
const QString KLanRegionWesternEuroDefaultCodec = KCodecISO_8859_1;

//Vietnamese
const QString KLanRegionVietnamese = QString::fromUtf8("Việt");
const QString KCodecWindows1258("windows-1258");
const QString KLanRegionVietnameseDefaultCodec = KCodecWindows1258;

//Other
const QString KCodecISO_8859_10("ISO-8859-10");
const QString KCodecISO_8859_16("ISO-8859-16");
const QString KCodecCS_KOI8R("csKOI8R");
const QString KCodecIBM_866("IBM866");

/**
 * Chapter key
 */
const QString KChapterKeyNone("");
const QString KChapterKeyChineseSimple = QString::fromUtf8(".{,5}第[0-9万千百十拾一壹二貳三叁四肆五伍六陆七柒八捌九玖\\s]*[章节卷]");
const QString KChapterKeyChineseTraditional = QString::fromUtf8(".{,5}第[0-9萬千百十拾壹一貳二叁三肆四伍五陆六柒七捌八玖九\\s]*[章節卷]");
const QString KChapterKeyEnglish = QString::fromUtf8(".{0,5}Chapter[0-9\\s]*");

const QString KChapterMark("*");
const int KChapterCheckingMaxLen = 30;

/**
 * Settings
 */
const QString KSettingFileName("ereader.ini");
const QString KSettingOrganization("lazyworm");
const QString KSettingApplication("ereader");
const QString KSettingGroup("config");
//Text settings
const QString KSettingGroupText(KSettingGroup+KPathSeparator+"text");

const QString KSettingTextColor(KSettingGroupText+KPathSeparator+"color");

const QString KSettingTextColorDefault("black");


const QString KSettingTextSmooth(KSettingGroupText+KPathSeparator+"smooth");
const bool KSettingTextSmoothDefault = true;

const QString KSettingTextLineSpace(KSettingGroupText+KPathSeparator+"line_space");
const int KSettingTextLineSpaceDefault = 4;

const QString KSettingTextBackgroud(KSettingGroupText+KPathSeparator+"background");
const QString KSettingTextBackgroudDefault = "bisque";

//Font settings
const QString KSettingGroupTextFont(KSettingGroupText+KPathSeparator+"font");

const QString KSettingTextFontBold(KSettingGroupTextFont+KPathSeparator+"bold");
const bool KSettingTextFontBoldDefault = false;

const QString KSettingTextFontFamiliy(KSettingGroupTextFont+KPathSeparator+"family");
const QString KSettingTextFontFamiliyDefault = "Arial";

const QString KSettingTextFontItalic(KSettingGroupTextFont+KPathSeparator+"italic");
const bool KSettingTextFontItalicDefault = false;

const QString KSettingTextFontLetterSpacing(KSettingGroupTextFont+KPathSeparator+"letting_spacing");
const double KSettingTextFontLetterSpacingDefault = 0.0;

const QString KSettingTextFontPixelSize(KSettingGroupTextFont+KPathSeparator+"pixel_size");
const int KSettingTextFontPixelSizeDefault = 30;

const QString KSettingTextFontPointSize(KSettingGroupTextFont+KPathSeparator+"point_size");
const double KSettingTextFontPointSizeDefault = 30.0;

const QString KSettingTextFontStrikeout(KSettingGroupTextFont+KPathSeparator+"strikeout");
const bool KSettingTextFontStrikeoutDefault = false;

const QString KSettingTextFontUnderline(KSettingGroupTextFont+KPathSeparator+"underline");
const bool KSettingTextFontUnderlineDefault = false;

const QString KSettingTextFontWeight(KSettingGroupTextFont+KPathSeparator+"weight");
const QFont::Weight KSettingTextFontWeightDefault = QFont::Normal;

const QString KSettingTextFontWordSpacing(KSettingGroupTextFont+KPathSeparator+"word_spacing");
const double KSettingTextFontWordSpacingDefault = 0.0;

const QString KSettingTextIgnoreEmptyLine(KSettingGroupTextFont+KPathSeparator+"ignore_empty_line");
const bool KSettingTextIgnoreEmptyLineDefault = false;

//General settings
const QString KSettingGroupGeneral(KSettingGroup+KPathSeparator+"general");
const QString KSettingGeneralCodec(KSettingGroupGeneral+KPathSeparator+"default_codec");
const QString KSettingGeneralCodecDefault = KCodecGB2312;

const QString KSettingGeneralOrientation(KSettingGroupGeneral+KPathSeparator+"orientation");
const int KSettingGeneralOrientationDefault = 15;//15 is the value of Auto

const QString KSettingGeneralShowToolbar(KSettingGroupGeneral+KPathSeparator+"show_tool_bar");
const bool KSettingGeneralShowToolbarDefault = true;

const QString KSettingGeneralLastReadPath(KSettingGroupGeneral+KPathSeparator+"last_read_path");
const QString KSettingGeneralLastReadPathDefault = "/home/user/MyDocs";

const QString KSettingGeneralShowQuickSetting(KSettingGroupGeneral+KPathSeparator+"show_quick_setting");
const bool KSettingGeneralShowQuickSettingDefault = true;

//Auto page turning
const QString KSettingGeneralAutoPageTurning(KSettingGroupGeneral+KPathSeparator+"auto_page_turning");
const bool KSettingGeneralAutoPageTurningDefault = false; //no auto page turning

const QString KSettingGeneralAutoPageTurningTimeOut(KSettingGroupGeneral+KPathSeparator+"auto_page_turning_time_out");
const int KSettingGeneralAutoPageTurningTimeOutDefault = 60; //60 seconds per page

const QString KSettingGeneralShowAutoPageTurningTime(KSettingGroupGeneral+KPathSeparator+"show_auto_page_turning_time");
const bool KSettingGeneralShowAutoPageTurningTimeDefault = true; //no auto page turning

//Disable display blank
const QString KSettingGeneralDisableDisplayBlank(KSettingGroupGeneral+KPathSeparator+"disable_display_blank");
const bool KSettingGeneralDisableDisplayBlankDefault = true; //disable display blank when reading
const int KDisableDisplayBlankFeedTimerInterval = 60000; //60 seconds

//Night mode
const QString KSettingGeneralNightMode(KSettingGroupGeneral+KPathSeparator+"night_mode");
const bool KSettingGeneralNightModeDefault = false;
const QString KNightModeFontColor = "bisque";
const QString KNightModeBackgroundColor = "black";

#endif // RCONSTDIFINITION_H
